package com.pine.dbant.core.web;

import com.pine.dbant.common.plugin.meta.MetadataNode;
import com.pine.dbant.core.model.vo.ConnectionVO;
import com.pine.dbant.core.service.ConnectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xiaoyuan
 * @create 2023/2/3 11:02
 **/
@Api(tags = "连接服务")
@RestController
@RequestMapping("/conn")
public class ConnectionController extends BaseHandler {

    @Autowired
    private ConnectionService connectionService;

    @ApiOperation("获取连接树")
    @GetMapping("/getTree")
    public List<MetadataNode> getTree() {
        return connectionService.getTree();
    }

    @ApiOperation("获取链接列表")
    @GetMapping("/list")
    public List<ConnectionVO> list(){
        return this.connectionService.list();
    }

}
